package com.ileaf.proxy.jdk;

import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;

/**
 * @author Lianlb
 * @date 2019-04-20 20:50
 */
public class PeopleInvocationHandler implements InvocationHandler {

    private Object people;

    public PeopleInvocationHandler(Object people) {
        this.people = people;
    }

    @Override
    public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
        System.out.println("jdk方法执行前日志...");
        System.out.println("jdk代理类 " + proxy.getClass().getName());
        System.out.println("jdk被代理类，即服务的真正提供者 " + people.getClass().getName());
        System.out.println("jdk执行的方法名 " + method.getName());
        method.invoke(people, args);
        return null;
    }
}
